package com.slytherin.sns.spider.controller;


import com.slytherin.sns.spider.base.SpiderBuilder;
import com.slytherin.sns.spider.empty.BuildScriptParam;
import com.slytherin.sns.spider.groovy.HaodouScriptTest;
import com.slytherin.sns.spider.task.executor.SlytherinTaskExecutor;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test/spider")
public class SpiderController {

    @Resource
    SlytherinTaskExecutor slytherinTaskExecutor;


    @RequestMapping("/hd")
    public String test() {
        BuildScriptParam buildScriptParam = new BuildScriptParam();

        buildScriptParam.setSeed("");
        buildScriptParam.setSourceCode(1);
        buildScriptParam.setTaskId(1L);
        slytherinTaskExecutor.buildScriptAsync(buildScriptParam);
        return "success";
    }

    @RequestMapping("/hd2")
    public String test2(){
        new SpiderBuilder(new HaodouScriptTest()).build("",false).run();
        return "success";
    }
}
